<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Info extends Front_Controller
{
	public static $m_arrTpl = array('news'=>'0','info'=>'1','cul'=>'2');
	function __construct()
	{
		parent::__construct();
		$this->load->helper(array('form'));
		$this->load->model('front/Info_mdl');
		
		$this->load->helper(array('form'));
		$this->load->model('front/Frontget_ml');
		$this->load->model('front/Search_m');		
		$this->siteSetings=$this->Frontget_ml->get_site_settings();	
		$this->announcement=$this->Frontget_ml->get_announcement();		
		$this->lineclass=$this->Frontget_ml->get_lineclass();
		$this->carclass=$this->Frontget_ml->get_carclass();
		$this->newsclass=$this->Frontget_ml->get_newsclass();
		$this->des_tags=$this->Search_m->get_des_tags();	

		$current_title     = $this->siteSetings["site_description"];
		$this->m_arrPublic =   array("newsclass"=>$this->newsclass,"carclass"=>$this->carclass,"lineclass"=>$this->lineclass,"des_tags"=>$this->des_tags,"current_title"=>$current_title,"siteSetings"=>$this->siteSetings);
	}
	
	
	public function infoList($p_sort = 'info')
	{
		$this->load->library('pagination');
		$config['base_url'] = site_url('/hotel/info_list/');
		$type=0	;
		$total_rows= $this->Info_mdl->getAllInfo(0,10,0,self::$m_arrTpl[$p_sort]);
		$config['total_rows'] =$total_rows;
		$config['per_page'] = 10;
		$config['uri_segment'] = 4;
		$config['full_tag_open'] = '';
		$config['full_tag_close'] = '';
		$config['cur_tag_open']= '&nbsp;<span class="current">';
		$config['cur_tag_close']= '</span>';
		$config['prev_link']= '上一页';
		$config['next_link']= '下一页';
		$config['first_link']= ' 首页';
		$config['last_link']= ' 尾页';
		$this->pagination->initialize($config);
		$begin_record = $this->uri->segment(4);
		$type=1;
		$arr['info'] = $this->Info_mdl->getAllInfo($begin_record,$config['per_page'],$type,self::$m_arrTpl[$p_sort]);	
		// 分页END
		$data  = $arr + $this->m_arrPublic;
		
		$this->load->view('info_list',$data);
	}
	
	public function singeinfo($p_id)
	{
		$arr = $this->Info_mdl->getInfo($p_id);
		$nextId = $this->Info_mdl->getNextInfoIdById($p_id);
		$arrNext['next'] = $this->Info_mdl->getInfo($nextId);
		if (empty($arrNext['next']))
		{
			$arrNext['next'] = array('id' => 0,'info_title' => '');
		}
		$data = $arr + $this->m_arrPublic + $arrNext;
		$this->load->view('info_show',$data);
	}
	
	public function index()
	{
		echo 'ddddd';
	}

}
